package pers.cz.chat.ui;

import javax.swing.*;
import java.io.File;

/**
 * @version 1.0
 * @description:
 * @author: ChengZhi 0336
 * @create: 2025-02-19 20:25
 **/
public class SettingUI {

	private JPanel mainPanel;
	private JPanel settingPanel;
	private JLabel urlLabel;
	private JTextField urlTextField;
	private JButton urlBtn;

	public SettingUI() {
		// 给按钮添加一个选择文件的事件
		urlBtn.addActionListener(e -> {
			JFileChooser fileChooser = new JFileChooser();
			fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
			fileChooser.showOpenDialog(settingPanel);
			File file = fileChooser.getSelectedFile();
			urlTextField.setText(file.getPath());
		});
	}

	public JComponent getComponent() {
		return mainPanel;
	}

	public JTextField getUrlTextField() {
		return urlTextField;
	}
}
